/*
 Navicat Premium Data Transfer

 Source Server         : localhost
 Source Server Type    : MySQL
 Source Server Version : 50719
 Source Host           : localhost
 Source Database       : blog

 Target Server Type    : MySQL
 Target Server Version : 50719
 File Encoding         : utf-8

 Date: 09/04/2017 01:05:00 AM
*/

SET NAMES utf8;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
--  Table structure for `blog_account`
-- ----------------------------
DROP TABLE IF EXISTS `blog_account`;
CREATE TABLE `blog_account` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键',
  `username` varchar(255) NOT NULL COMMENT '登录名',
  PRIMARY KEY (`id`),
  UNIQUE KEY `blog_account_username` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
--  Table structure for `blog_account_login`
-- ----------------------------
DROP TABLE IF EXISTS `blog_account_login`;
CREATE TABLE `blog_account_login` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键',
  `login_name` varchar(255) NOT NULL COMMENT '登录名',
  `login_pwd` varchar(255) NOT NULL COMMENT '登录密码',
  `salt` varchar(255) NOT NULL COMMENT '混淆密码的盐',
  `account_id` int(11) NOT NULL COMMENT '账户主键指向管理员账户',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
--  Table structure for `blog_article`
-- ----------------------------
DROP TABLE IF EXISTS `blog_article`;
CREATE TABLE `blog_article` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键',
  `title` varchar(1000) NOT NULL COMMENT '标题',
  `summary` varchar(2000) NOT NULL COMMENT '摘要(列表展示时显示)',
  `content` longtext NOT NULL COMMENT '内容',
  `thumbnail` varchar(255) DEFAULT NULL COMMENT '缩略图',
  `created` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
  `modified` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '最后一次修改时间',
  `article_mode` int(11) NOT NULL COMMENT '内容模式指向模式表主键',
  `status` int(11) NOT NULL COMMENT '当前状态',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
--  Table structure for `blog_article_category`
-- ----------------------------
DROP TABLE IF EXISTS `blog_article_category`;
CREATE TABLE `blog_article_category` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键',
  `category_id` int(11) NOT NULL COMMENT '文集／类别主键',
  `article_id` int(11) NOT NULL COMMENT '文章主键',
  `created` datetime DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
--  Table structure for `blog_article_info`
-- ----------------------------
DROP TABLE IF EXISTS `blog_article_info`;
CREATE TABLE `blog_article_info` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键',
  `article_id` int(11) NOT NULL COMMENT '文章主键',
  `browse_num` int(11) NOT NULL DEFAULT '0' COMMENT '浏览次数',
  `comment_num` int(11) NOT NULL DEFAULT '0' COMMENT '评论次数',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
--  Table structure for `blog_article_mode`
-- ----------------------------
DROP TABLE IF EXISTS `blog_article_mode`;
CREATE TABLE `blog_article_mode` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键',
  `mode` varchar(255) NOT NULL COMMENT '模式名称',
  PRIMARY KEY (`id`),
  UNIQUE KEY `blog_article_mode` (`mode`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `blog_article_mode`
-- ----------------------------
BEGIN;
INSERT INTO `blog_article_mode` VALUES ('2', 'html'), ('1', 'markdown');
COMMIT;

-- ----------------------------
--  Table structure for `blog_article_tag`
-- ----------------------------
DROP TABLE IF EXISTS `blog_article_tag`;
CREATE TABLE `blog_article_tag` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键',
  `article_id` int(11) NOT NULL COMMENT '指向文章主键',
  `tag` varchar(255) NOT NULL COMMENT '文章标签',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
--  Table structure for `blog_feedback`
-- ----------------------------
DROP TABLE IF EXISTS `blog_feedback`;
CREATE TABLE `blog_feedback` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键',
  `content` varchar(255) NOT NULL COMMENT '意见反馈内容',
  `contact` varchar(255) NOT NULL COMMENT '联系方式',
  `created` datetime NOT NULL COMMENT '反馈时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `blog_feedback`
-- ----------------------------
BEGIN;
INSERT INTO `blog_feedback` VALUES ('2', 'hhhh', 'vbvbvb', '2017-09-03 04:44:08');
COMMIT;

-- ----------------------------
--  Table structure for `blog_gender`
-- ----------------------------
DROP TABLE IF EXISTS `blog_gender`;
CREATE TABLE `blog_gender` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键',
  `gender` varchar(255) NOT NULL COMMENT '性别',
  PRIMARY KEY (`id`),
  UNIQUE KEY `blog_gender` (`gender`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `blog_gender`
-- ----------------------------
BEGIN;
INSERT INTO `blog_gender` VALUES ('3', '女'), ('1', '未知'), ('2', '男');
COMMIT;

-- ----------------------------
--  Table structure for `blog_login_mode`
-- ----------------------------
DROP TABLE IF EXISTS `blog_login_mode`;
CREATE TABLE `blog_login_mode` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键',
  `mode` varchar(255) NOT NULL COMMENT '登录模式',
  `local` int(11) NOT NULL COMMENT '是否是本地账号',
  PRIMARY KEY (`id`),
  UNIQUE KEY `blog_login_mode` (`mode`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `blog_login_mode`
-- ----------------------------
BEGIN;
INSERT INTO `blog_login_mode` VALUES ('1', 'phone', '1'), ('2', 'email', '1'), ('3', 'username', '1'), ('4', 'qq', '0'), ('5', 'wechat', '0'), ('6', 'sina', '0'), ('7', 'github', '0'), ('8', 'facebook', '0'), ('9', 'google', '0'), ('10', 'twitter', '0');
COMMIT;

-- ----------------------------
--  Table structure for `blog_user`
-- ----------------------------
DROP TABLE IF EXISTS `blog_user`;
CREATE TABLE `blog_user` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键',
  `username` varchar(255) DEFAULT NULL COMMENT '登录名',
  `nickname` varchar(255) NOT NULL COMMENT '昵称',
  `realname` varchar(255) DEFAULT NULL COMMENT '实名',
  `email` varchar(255) DEFAULT NULL COMMENT '邮箱',
  `email_enable` int(11) DEFAULT NULL COMMENT '邮箱是否验证',
  `phone` varchar(255) DEFAULT NULL COMMENT '手机',
  `phone_enable` int(11) DEFAULT NULL COMMENT '手机号是否验证',
  `gender` int(11) NOT NULL COMMENT '性别指向性别表主键',
  `signature` varchar(255) DEFAULT NULL COMMENT '个性签名',
  `birthday` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '生日',
  `created` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
  `modified` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '最后一次修改时间',
  `activated` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '激活时间',
  `status` int(11) NOT NULL COMMENT '状态',
  `head_portrait` varchar(255) DEFAULT NULL COMMENT '用户头像',
  PRIMARY KEY (`id`),
  UNIQUE KEY `blog_user_username` (`username`) USING HASH COMMENT '登录名唯一索引',
  UNIQUE KEY `blog_user_email` (`email`) USING BTREE COMMENT '邮箱唯一索引',
  UNIQUE KEY `blog_user_phone` (`phone`) USING BTREE COMMENT '手机唯一索引'
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `blog_user`
-- ----------------------------
BEGIN;
INSERT INTO `blog_user` VALUES ('1', null, 'MllWeb', null, 'mllweb@163.com', '0', null, '0', '1', null, '2017-09-03 00:17:17', '2017-09-03 00:17:17', '2017-09-03 00:17:17', '2017-09-03 00:17:17', '0', '/image/header/c45f4a33-02ae-41e4-a903-a9163f152685.jpeg');
COMMIT;

-- ----------------------------
--  Table structure for `blog_user_category`
-- ----------------------------
DROP TABLE IF EXISTS `blog_user_category`;
CREATE TABLE `blog_user_category` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键',
  `user_id` int(11) NOT NULL COMMENT '用户主键',
  `category` varchar(255) NOT NULL COMMENT '分类',
  `article_num` int(11) DEFAULT '0' COMMENT '文章数量',
  `follow_num` int(11) DEFAULT NULL COMMENT '关注数量',
  `created` datetime DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `blog_user_category` (`user_id`,`category`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `blog_user_category`
-- ----------------------------
BEGIN;
INSERT INTO `blog_user_category` VALUES ('1', '1', 'Java', '0', '0', '2017-09-03 21:03:41'), ('2', '1', 'Android', '0', '0', '2017-09-03 21:07:22');
COMMIT;

-- ----------------------------
--  Table structure for `blog_user_login`
-- ----------------------------
DROP TABLE IF EXISTS `blog_user_login`;
CREATE TABLE `blog_user_login` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键',
  `user_id` int(11) NOT NULL COMMENT '用户主键指向用户表主键',
  `login_name` varchar(255) NOT NULL COMMENT '登录名',
  `login_pwd` varchar(255) NOT NULL COMMENT '登录密码',
  `salt` varchar(255) NOT NULL COMMENT '混淆密码的盐',
  `login_mode` int(11) NOT NULL COMMENT '登录模式指向登录模式表主键',
  PRIMARY KEY (`id`),
  UNIQUE KEY `blog_user_login_name` (`login_name`) COMMENT '唯一登录名索引'
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `blog_user_login`
-- ----------------------------
BEGIN;
INSERT INTO `blog_user_login` VALUES ('1', '1', 'mllweb@163.com', 'f646ac636eac6278bf8c0efe986b7f76', '5bf95ce9-f3b8-4f30-92ca-90500a3d441b', '2');
COMMIT;

-- ----------------------------
--  Table structure for `blog_user_validate`
-- ----------------------------
DROP TABLE IF EXISTS `blog_user_validate`;
CREATE TABLE `blog_user_validate` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键',
  `validate_user` varchar(255) NOT NULL COMMENT '验证账号',
  `created` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
  `login_mode` int(11) NOT NULL COMMENT '验证方式指向登录方式',
  `validate_code` varchar(500) NOT NULL COMMENT '公钥验证数字签名',
  `expiration` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '有效期',
  `validated` int(11) NOT NULL COMMENT '是否已经验证',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `blog_user_validate`
-- ----------------------------
BEGIN;
INSERT INTO `blog_user_validate` VALUES ('1', 'mllweb@163.com', '2017-09-02 17:32:04', '2', 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCi2Uki/eMjPIA5yosXCDArDiukSihXLaYo0tELExTZEtY8htlz7x9M4z0XiFL1F3WVMrLQfoTzMkmMtsVk0SvByFB8Cx7dbR0qXXAt4Z/DZIG6BnZiIWTJ/xQ8IUr7DdrI+yrIdd9gtJ2YkCRsSxqAG2SGTzQU3T3CbfC97mK7IQIDAQAB', '2017-09-03 17:32:05', '0');
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
